package protocol;

public class XmlParser {

	/**
	 * Util method to find the value from an xml string by tag
	 * @param source
	 * @param tag
	 * @return
	 */
	public static String readByTag(String source, String tag, int from) {
		String value = null;
		int beginIndex = source.indexOf(tag, from);
		if(beginIndex > 0) {
			int endIndex = source.indexOf('<', beginIndex+1);
			if(endIndex > 0) {
				value = source.substring(beginIndex+tag.length(), endIndex);
			}
		}
		return value;
	}

}
